package main

import (
	"net/http"
	"fmt"
	"log"
)

const (
	htmlTop = `
		<!DOCTYPE html>
		<html lang="en">
		<head>
		    <meta charset="UTF-8">
		    <title>Title</title>
		</head>
		<body>
	`
	form = `
		<h1>SillyHat Golang Study Hello World!</h1>
		<h2>SillyHat Golang Study Hello World!</h2>
		<h3>SillyHat Golang Study Hello World!</h3>
		<h4>SillyHat Golang Study Hello World!</h4>
		<h5>SillyHat Golang Study Hello World!</h5>
	`
	htmlBottom = `
		</body>
	</html>
	`
)

func main() {
	log.Println("start server begin")
	http.HandleFunc("/", homePage)
	log.Println("setup server port")
	if err := http.ListenAndServe(":9001", nil); err != nil {
		log.Fatal("failed to start server", err)
	}
	log.Println("start server end")
}

func homePage(writer http.ResponseWriter, request *http.Request) {
	fmt.Fprint(writer, htmlTop, form ,htmlBottom)
}